package middleware

import (
	"encoding/json"
	"github.com/beego/beego/v2/adapter/context"
	"weekFirst/pkg"
)

func TokenAuth(ctx context.Context) string {

	data := ctx.Input.GetData("userId")

	marshal, _ := json.Marshal(data)

	token, err := pkg.ParseToken("2204aaaaaaaaaaa00444", string(marshal))
	if err != nil {
		return ""
	}

	//value:=l.ctx.Value("custom-key")

	//userId := ctx.Input.GetData(token)

	return token
}
